Optimal. Leaf size=66 \[ -\frac {a x}{a^2+b^2}-\frac {\log (\cos (c+d x))}{b d}+\frac {a^2 \log (a \cos (c+d x)+b \sin (c+d x))}{b \left (a^2+b^2\right ) d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 77, normalized size of antiderivative = 1.17, number of steps
used = 4, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3622, 3556,
3565, 3611} \begin {gather*} \frac {a^2 \log (a \cos (c+d x)+b \sin (c+d x))}{b d \left (a^2+b^2\right )}+\frac {a^3 x}{b^2 \left (a^2+b^2\right )}-\frac {a x}{b^2}-\frac {\log (\cos (c+d x))}{b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3565
Rule 3611
Rule 3622
Rubi steps
\begin {align*} \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx &=-\frac {a x}{b^2}+\frac {a^2 \int \frac {1}{a+b \tan (c+d x)} \, dx}{b^2}+\frac {\int \tan (c+d x) \, dx}{b}\\ &=-\frac {a x}{b^2}+\frac {a^3 x}{b^2 \left (a^2+b^2\right )}-\frac {\log (\cos (c+d x))}{b d}+\frac {a^2 \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{b \left (a^2+b^2\right )}\\ &=-\frac {a x}{b^2}+\frac {a^3 x}{b^2 \left (a^2+b^2\right )}-\frac {\log (\cos (c+d x))}{b d}+\frac {a^2 \log (a \cos (c+d x)+b \sin (c+d x))}{b \left (a^2+b^2\right ) d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.10, size = 78, normalized size = 1.18 \begin {gather*} \frac {b (i a+b) \log (i-\tan (c+d x))+b (-i a+b) \log (i+\tan (c+d x))+2 a^2 \log (a+b \tan (c+d x))}{2 b \left (a^2+b^2\right ) d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.11, size = 68, normalized size = 1.03
method | result | size |
derivativedivides | \(\frac {\frac {\frac {b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}-a \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}+\frac {a^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right ) b}}{d}\) | \(68\) |
default | \(\frac {\frac {\frac {b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}-a \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}+\frac {a^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right ) b}}{d}\) | \(68\) |
norman | \(-\frac {a x}{a^{2}+b^{2}}+\frac {a^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{b d \left (a^{2}+b^{2}\right )}+\frac {b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{2}+b^{2}\right )}\) | \(71\) |
risch | \(\frac {x}{i b -a}+\frac {2 i x}{b}+\frac {2 i c}{b d}-\frac {2 i a^{2} x}{b \left (a^{2}+b^{2}\right )}-\frac {2 i a^{2} c}{b d \left (a^{2}+b^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{b d}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{b d \left (a^{2}+b^{2}\right )}\) | \(140\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.53, size = 72, normalized size = 1.09 \begin {gather*} \frac {\frac {2 \, a^{2} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} b + b^{3}} - \frac {2 \, {\left (d x + c\right )} a}{a^{2} + b^{2}} + \frac {b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.53, size = 89, normalized size = 1.35 \begin {gather*} -\frac {2 \, a b d x - a^{2} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) + {\left (a^{2} + b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, {\left (a^{2} b + b^{3}\right )} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 0.51, size = 405, normalized size = 6.14 \begin {gather*} \begin {cases} \tilde {\infty } x \tan {\left (c \right )} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {i d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {\log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\- \frac {i d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {\log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {- x + \frac {\tan {\left (c + d x \right )}}{d}}{a} & \text {for}\: b = 0 \\\frac {x \tan ^{2}{\left (c \right )}}{a + b \tan {\left (c \right )}} & \text {for}\: d = 0 \\\frac {2 a^{2} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} b d + 2 b^{3} d} - \frac {2 a b d x}{2 a^{2} b d + 2 b^{3} d} + \frac {b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} b d + 2 b^{3} d} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.64, size = 73, normalized size = 1.11 \begin {gather*} \frac {\frac {2 \, a^{2} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b + b^{3}} - \frac {2 \, {\left (d x + c\right )} a}{a^{2} + b^{2}} + \frac {b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.05, size = 78, normalized size = 1.18 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,d\,\left (b+a\,1{}\mathrm {i}\right )}+\frac {a^2\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{b\,d\,\left (a^2+b^2\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (a+b\,1{}\mathrm {i}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________